<template>
  <div class="header">
    <!-- <slot name="slot1"></slot>
    <slot name="slot2"></slot>
    <slot name="slot3"></slot> -->

    <div class="employees-header clear">
      <div class="header-left">
        <i class="el-icon-search"></i>
        <span>筛选查询</span>
      </div>
      <div class="header-right">
        <span @click="shouqi" class="shou"
          ><i
            :class="{ 'el-icon-arrow-up': tab, 'el-icon-arrow-down': !tab }"
          ></i
          >收起筛选</span
        >
        <el-button @click="sel">查询结果</el-button>
      </div>
    </div>
    <div class="header-from" :class="{ 'header-from1': tab }">
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item label="输入搜索" v-if="input" >
          <el-input
            v-model="formInline.user"
            placeholder="用户名/姓名"
          ></el-input>
        </el-form-item>
        <template v-for="(item,index) in select">
          <el-form-item :label="item.label" v-if="select" :key="index+''">
          <el-select v-model="formInline[item.user]" placeholder="全部">
            <el-option v-for="list in item.select" :key="list" :label="list" :value="list"></el-option>
          </el-select>
        </el-form-item>
        </template>

         <el-form-item label="创建日期:" v-if="date">
            <el-date-picker
              type="date"
              placeholder="选择日期"
              v-model="formInline.date"
              style="width: 100%"
            ></el-date-picker>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
export default {
  name: "ShaiXuan",
  data() {
    return {
      tab: true,
      formInline: {
        user: "",
        region: "",
        date:"",
      },
    };
  },
  props: {
    select:{
      Object,
      default:false
    },
    input:{
      Boolean,
      default:false
    },
    date:{
      Boolean,
      default:false
    }
  },

  methods: {
    shouqi() {
      this.tab = !this.tab;
    },
    sel() {
      this.$emit("sss", this.formInline);
    },
  },
  mounted() {
    console.log(1);
  },
};
</script>
<style lang="scss" scoped>
.header {
  border: 1px solid rgb(217, 217, 217);

  & .employees-header {
    height: 60px;
    line-height: 60px;
    padding: 0 20px;
    border: 1px solid rgb(217, 217, 217);
    background-color: rgb(232, 232, 232);
    border-bottom: none;
  }
  & .header-left {
    float: left;
  }
  & .header-right {
    float: right;
  }
  & .header-from {
    padding: 0 50px;
    height: 0px;
    overflow: hidden;
    transition: all 0.5s;
  }
  & .header-from1 {
    height: 60px;
  }
  & .demo-form-inline {
    margin-top: 10px;
  }
  & .shou {
    cursor: pointer;
    margin-right: 20px;
  }
}
</style>